<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'video-form',
	'enableAjaxValidation'=>false,
   'htmlOptions'=>array('enctype'=>'multipart/form-data')
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>


	<div class="row">
		<?php echo $form->labelEx($model,'video_title'); ?>
		<?php echo $form->textField($model,'video_title',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'video_title'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'video_desc'); ?>
		<?php echo $form->textField($model,'video_desc',array('size'=>60,'maxlength'=>500)); ?>
		<?php echo $form->error($model,'video_desc'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'video_name'); ?>
		<?php echo $form->fileField($model,'video_name',array('size'=>60,'maxlength'=>500)); ?>
		<?php echo $form->error($model,'video_name'); ?>
	</div>
        
        <div class="row">
		<?php echo $form->labelEx($model,'video_type'); ?>
		<?php echo $form->dropDownList($model,'video_type',  CHtml::listData(JobType::model()->findAll(), 'jtID', 'job_type'),array('empty'=>'Select Job Type')); ?>
		<?php echo $form->error($model,'video_type'); ?>
	</div>
        <div class="row">
		<?php echo $form->labelEx($model,'enable'); ?>
		<?php echo $form->dropDownList($model,'enable', array('1'=>'Yes','0'=>'No')); ?>
		<?php echo $form->error($model,'enable'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save',array('id'=>'submit')); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->
<script type="text/javascript">
$('#submit').bind('click', function() {
var myFile = document.getElementById('Video_video_name');
 

  //this.files[0].size gets the size of your file.
  var file_size = myFile.files[0].size/(1024*1024);
  var postlimit = <?php echo (int)(ini_get('post_max_size')); ?>;
  var uploadlimit = <?php echo (int)(ini_get('upload_max_filesize')); ?>;
  if(uploadlimit > postlimit)
      {
         var filelimit = postlimit;
      }
      else
          {
            var filelimit = uploadlimit;
          }
  //alert (postlimit);
  if( file_size > filelimit)
     { 
  alert("Please upload file limit less than"+filelimit+"MB");
  return false;
     }
     else
        {
           return true; 
        } 
     
});
</script>    